package com.example.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.entity.GoodsCategory;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Component;

import java.util.List;

@Mapper
public interface GoodsCategoryMapper extends BaseMapper<GoodsCategory> {
    @Select("select id from goods_category where name = #{name}")
    Long getGoodsCategoryIdByName(@Param("name") String name);

    @Select("select id from goods_category where parent_id =#{parentId} ")
    List<Long> getChildrenByPatent(@Param("parentId") Long parentId);

    @Update("update goods_category set is_show = #{status} where id = #{categoryId}")
    int updateStatus(@Param("status") boolean status,@Param("categoryId") Long categoryId);
}
